<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>大爱优能教育</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<SCRIPT type="text/javascript" src="<%=basePath%>/js/jquery-1.9.1.min.js"></SCRIPT>
		<SCRIPT type="text/javascript" src="<%=basePath%>/js/ajaxfileupload.js"></SCRIPT>
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<SCRIPT type="text/javascript">
	$(function(){
		 $("#btn_upload").click(function(){

        $.ajaxFileUpload
        (
            {
                url: '/edu/index/upload', //用于文件上传的服务器端请求地址
                secureuri: false, //是否需要安全协议，一般设置为false
                fileElementId: 'upload', //文件上传域的ID
                dataType: 'json', //返回值类型 一般设置为json
                success: function (data,status)  //服务器成功响应处理函数
                {
                    $("#photo_path").attr("src", "/edu/picture/"+data.photo_path);
                  
                    //  alert("success:"+data.msg);
                      
                  
                },
                error:function (data, status,e )
                {
					alert("error:"+data.msg);
                }
            }
        )
      //  return false;
		    });
	});
	</SCRIPT>
	</head>

	<body>
		<%--<form action="/user/login">
			<input type="text" name="userName" />
			<br />
			<input type="password" name="pwd" />
			<br />
			<input type="submit" text="commit" />
		</form>
	--%>
<!-- <form action="/edu/index/upload"  method="post" enctype="multipart/form-data"> -->
<input type="file" name="upload" id="upload" />
	<img id="photo_path" src="#"/>
	<input type="button" id="btn_upload" value="上传"  />
	<input type="submit" value="submit" />
<!-- </form> -->
	
	</body>
</html>
